package com.heima.kafka.sample;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProducerBoot {
    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;

    public  void main(String[] args) {
        for (int i = 0; i <5 ; i++) {
            if(i%2==0){
                kafkaTemplate.send("boot-01","hello boot kafka");
            }else{
                kafkaTemplate.send("boot-01","hello itcast");
            }
        }
    }
}